<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Father{
            static instance = null;
            constructor(name) {
                this.name = name;
                if (!Father.instance) {
                    Father.instance = this;
                    console.log(this);
                } else {
                    return  Father.instance;
                }
            }
        }
        let f1 = new Father('张三');
        let f2 = new Father('李四');
        console.log(f1, f2);
    </script>
    
</body>
</html>